<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
		<link href="../css/register.css" rel="stylesheet" type="text/css"/>
		<script src="../js/mui.js"></script>
		<script src="../js/req.js"></script>
		<script src="../js/jquery.min.js"></script>
		<script type="text/javascript">
			mui.ready(function() {
				mui.init()

				mui('#box').on('tap','#back',function(){
					mui.openWindow('../user/login.html','login',{})
				})

				mui('#box2').on('tap', '#adminlogin', function() {
					console.log("1111")

					var phone = $("#phone").val();
					console.log(phone)
					var pwd = $("#pwd").val();
					console.log(pwd)
					if (phone == "") {
						mui.toast('手机号不能为空')
						return;
					}
					if (pwd == "") {
						mui.toast('密码不能为空')
						return;
					}

					mui.ajax(apiurl+'api/mlogin', {
						data: {
							"phone": phone,
							"pwd": pwd
						},
						dataType: 'json', //服务器返回json格式数据
						type: 'post', //HTTP请求类型
						timeout: 10000, //超时时间设置为10秒；
						headers: {
							'Content-Type': 'application/json'
						},
						success: function(data) {
							console.log(data)
							if (data.code == 200) {
								console.log("chenggong")
								localStorage.setItem("mtoken", data.token)
								mui.openWindow('mindex.html', 'mindex', {})
							} else {
								mui.toast('用户名或者密码错误')
							}
						},
					});

				})

			})
		</script>
		<style>
			input::placeholder {
				color: white;
			}

			#a {
				width: 50px;
				height: 50px;
				color: white;
			}
			.mui-input-group {
				background-color: #ffffff00;
				margin-top: 20%;
			}

			#bgimg {
				width: 100%;
				height: 100%;
				display: block;
				position: absolute;
				top: 0;
				z-index: -3;
			}

			#logoimg {
				width: 160px;
				height: 160px;
				display: block;
				margin: 10% auto;
				;
			}

			.mui-btn {
				border-radius: 20px;
			}
			
			#back{
				width:50px;
				margin-left:5%;
				background-color: #5DB1FA;
				/* color: #FFFFFF; */
			}
			
			#adminlogin{
				/* width: 160px; */
				height: 45px;
			/* 	text-align: center;
				vertical-align: center; */
				line-height: 10px;
			}
			
		</style>
	</head>

	<body>
		<img id='bgimg' src="../img/login2.png" alt="" />

		<div id="box">
			<!-- <button id="back" type="button" class="mui-btn" style="font-size: 16px">返回</button> -->
			<img id="back" src="../img/返回按钮-1.png" alt="" />
		</div>
		<img id="logoimg" src="../img/logo-lan-queding.png" alt="" />

		<p style="text-align: center;color: white;font-family: 隶书;font-size: 50px;">管理员登录</p>

		<form class="mui-input-group">

			<div class="mui-input-row">
				<input type="text" id="phone" class="mui-input-clear" placeholder="请输入手机号">
			</div>
			<div class="mui-input-row">
				<input type="password" id="pwd" class="mui-input-clear" placeholder="请输入密码">
			</div>

			<div id="box2">
				<button id="adminlogin" type="button" class="mui-btn mui-btn-block mui-btn-blue">登录</button>
			</div>
		</form>
	</body>

</html>